import mockRequest from '@/utils/mockRequest'
/**
 * @description 获取购物车
 * @returns promise
 */
export const reqCartList = function () {
  return mockRequest.get('/api/cart/cartList')
}
/**
 * @description 切换商品状态
 * @param {*} skuID 商品id
 * @param {*} isChecked 用户本地点击的商品状态
 * @returns promise
 */
export const reqCheckCart = function(skuID, isChecked) {
  return mockRequest.get(`/api/cart/checkCart/${skuID}/${isChecked}`)
}
/**
 * @description 根据全选状态更新商品选中状态
 * @param {*} isChecked 全选状态
 * @param {*} skuIdList 商品id数组
 * @returns promise
 */
export const reqBatchCheckCart = function(isChecked, skuIdList) {
  return mockRequest.post(`/api/cart/batchCheckCart/${isChecked}`, skuIdList)
}
/**
 * @description 删除单个商品
 * @param {*} skuId 商品id
 * @returns promise
 */
export const reqDeleteCart = function(skuId) {
  return mockRequest.delete(`/api/cart/deleteCart/${skuId}`)
}
/**
 * @description 删除多个商品
 * @param {*} skuIdList 商品id组
 * @returns promise
 */
export const reqBatchDeleteCart = function(skuIdList) {
  return mockRequest.post('/api/cart/batchDeleteCart', skuIdList)
}
